Skip to content

Conversation

pamelafox
Copy link
Collaborator

@pamelafox pamelafox commented Sep 9, 2025

Purpose

Fixes #2718 so that prepdocs can ingest documents for indexes that do not have an images field.
Adds test to ensure that images field is not set on uploaded documents in that case.

Does this introduce a breaking change?

When developers merge from main and run the server, azd up, or azd deploy, will this produce an error?
If you're not sure, try it out on an old environment.

[ ] Yes
[X] No

Does this require changes to learn.microsoft.com docs?

This repository is referenced by this tutorial
which includes deployment, settings and usage instructions. If text or screenshot need to change in the tutorial,
check the box below and notify the tutorial author. A Microsoft employee can do this for you if you're an external contributor.

[ ] Yes
[X] No

Type of change

[X] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

Code quality checklist

See CONTRIBUTING.md for more details.

  • The current tests all pass (python -m pytest).
  • I added tests that prove my fix is effective or that my feature works
  • I ran python -m pytest --cov to verify 100% coverage of added lines
  • I ran python -m mypy to check for type errors
  • I either used the pre-commit hooks or ran ruff and black manually on my code.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where document ingestion fails when indexes don't have an images field by conditionally adding the images field only when search_images is enabled. The fix prevents the prepdocs script from setting an images field on uploaded documents when the search index doesn't support images.

  • Refactored document creation logic to conditionally include images field based on search_images flag
  • Added comprehensive test coverage to verify images field is excluded when search_images is False

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
app/backend/prepdocslib/searchmanager.py Modified update_content method to conditionally add images field only when search_images is True
tests/test_searchmanager.py Added new test case to verify images field is not included in documents when search_images is disabled

}
for image in section.chunk.images
],
**image_fields,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@pamelafox pamelafox merged commit 165dcac into Azure-Samples:main Sep 9, 2025
21 checks passed
@pamelafox pamelafox deleted the multimodalingestfix branch September 9, 2025 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

running prepdocs.py now produces err: Cannot find nested property 'images' on the resource type 'search.documentFields'.
2 participants